package com.bona.service.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bona.dao.common.BaseDao;
import com.bona.dao.system.SysTypeDao;
import com.bona.model.system.SysTypeModel;
import com.bona.service.common.BaseService;
import com.bona.util.common.StringUtil;
import com.bona.util.common.UUIDGenerator;

@Service("typeService")
@Transactional
public class SysTypeService extends BaseService {

	@Autowired
	private SysTypeDao typeDao;
	
	@Override
	public BaseDao getDao() {
		return typeDao;
	}

	/**
	 * 添加或更新分组明细信息
	 * @param model
	 */
	public void addOrUpdate(SysTypeModel model) {
		
		if (StringUtil.isEmpty(model.getId())) { // 新增
			model.setId(UUIDGenerator.generate());
			typeDao.add(model);
			return;
		}
		typeDao.update(model);
	}
}
